@extends('admin.frame_layout')
<?php $top_selected = "工作台";$page_menu = "资金报表" ?>

@section('content')
    <div class="mainbox">
        <div class="mainleft">

            <div class="leftinfo">
                <div class="listtitle"><a href="#" class="more1">报表</a>资金流水 - 数据统计（7天）</div>
                <div id="inout" style="height: 250px; width: 100%;"></div>
            </div>

            <div class="leftinfo" style="margin-top: 8px;">
                <div class="listtitle"><a href="#" class="more1">报表</a>奖金与税收 - 数据统计（7天）</div>
                <div id="bonus" style="height: 250px; width: 100%;"></div>
            </div>
        </div>

        <div class="mainright">
            <div class="dflist" style="height: 590px;">
                <div class="listtitle">系统账单详细报表 ( 除税收统计 )</div>
                <ul class="newlist">
                    <li>
                        <i>总流入资金：</i>
                        <b>¥ {{ countByMoneyLog('in') }}</b>
                    </li>
                    <li>
                        <i>总流出资金：</i>
                        <b>¥ {{ countByMoneyLog('out') }}</b>
                    </li>
                    <li>
                        <i>总税收额：</i>
                        <b>¥ {{ tax_count() }}</b>
                    </li>
                    <li>
                        <i>总提现额：</i>
                        <b>¥ {{ countByWithdrawLog('money') }} / ¥ {{ countByWithdrawLog('tax_money') }} (税)</b>
                    </li>
                    <li>
                        <i>见点奖发放额：</i>
                        <b>¥ {{ countByMoneyLog('b1') }} / ¥ {{ countByMoneyLog('b1_tax') }} (税)</b>
                    </li>
                    <li>
                        <i>报单奖发放额：</i>
                        <b>¥ {{ countByMoneyLog('b2') }} / ¥ {{ countByMoneyLog('b2_tax') }} (税)</b>
                    </li>
                    <li>
                        <i>层碰奖发放额：</i>
                        <b>¥ {{ countByMoneyLog('b3') }} / ¥ {{ countByMoneyLog('b3_tax') }} (税)</b>
                    </li>
                    <li>
                        <i>对碰奖发放额：</i>
                        <b>¥ {{ countByMoneyLog('b4') }} / ¥ {{ countByMoneyLog('b4_tax') }} (税)</b>
                    </li>
                    <li>
                        <i>领导奖发放额：</i>
                        <b>¥ {{ countByMoneyLog('b5') }} / ¥ {{ countByMoneyLog('b5_tax') }} (税)</b>
                    </li>
                    <li>
                        <i>分红奖发放额：</i>
                        <b>¥ {{ countByMoneyLog('b6') }} / ¥ {{ countByMoneyLog('b6_tax') }} (税)</b>
                    </li>
                    <li>
                        <i>A区总业绩：</i>
                        <b>¥ {{$score->a_count}}</b>
                    </li>
                    <li>
                        <i>A区剩余结余：</i>
                        <b>¥ {{$score->a_over}}</b>
                    </li>
                    <li>
                        <i>B区总业绩：</i>
                        <b>¥ {{$score->b_count}}</b>
                    </li>
                    <li>
                        <i>B区剩余结余：</i>
                        <b>¥ {{$score->b_over}}</b>
                    </li>
                </ul>
            </div>
        </div>
    </div>
@endsection

@section('footer')
    <script src="{{asset('admin/js/echarts.min.js')}}"></script>
    <script type="text/javascript">
        var inOutChart = echarts.init(document.getElementById('inout'));
        var inOutOption = null;
        var bonusChart = echarts.init(document.getElementById('bonus'));
        var bonusOption = null;

        var xDate = JSON.parse('{!!  $date !!}');
        var inMoney = JSON.parse('{!!  $in !!}');
        var outMoney = JSON.parse('{!!  $out !!}');
        var b1 = JSON.parse('{!!  $b1 !!}');
        var b2 = JSON.parse('{!!  $b2 !!}');
        var b3 = JSON.parse('{!!  $b3 !!}');
        var b4 = JSON.parse('{!!  $b4 !!}');
        var b5 = JSON.parse('{!!  $b5 !!}');
        var b6 = JSON.parse('{!!  $b6 !!}');

        $(function () {
            inOutOption = {
                tooltip: {
                    trigger: 'axis',
                    axisPointer: {            // 坐标轴指示器，坐标轴触发有效
                        type: 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
                    }
                },
                legend: {
                    data: ['当天入金', '当天支出']
                },
                grid: {
                    left: '3%',
                    right: '4%',
                    bottom: '3%',
                    containLabel: true
                },
                xAxis: [
                    {
                        type: 'category',
                        data: xDate
                    }
                ],
                yAxis: [
                    {
                        type: 'value'
                    }
                ],
                series: [
                    {
                        name: '当天入金',
                        type: 'bar',
                        barWidth: 50,
                        data: inMoney
                    },
                    {
                        name: '当天支出',
                        type: 'bar',
                        stack: '广告',
                        barWidth: 50,
                        data: outMoney
                    }
                ]
            };
            inOutChart.setOption(inOutOption);

            bonusOption = {
                tooltip: {
                    trigger: 'axis',
                    axisPointer: {            // 坐标轴指示器，坐标轴触发有效
                        type: 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
                    }
                },
                legend: {
                    data: ['见点奖', '报单奖', '层碰奖', '对碰奖', '领导奖', '分红奖']
                },
                grid: {
                    left: '3%',
                    right: '4%',
                    bottom: '3%',
                    containLabel: true
                },
                xAxis: [
                    {
                        type: 'category',
                        data: xDate
                    }
                ],
                yAxis: [
                    {
                        type: 'value'
                    }
                ],
                series: [
                    {
                        name: '见点奖',
                        type: 'bar',
                        data: b1
                    },
                    {
                        name: '报单奖',
                        type: 'bar',
                        data: b2
                    },
                    {
                        name: '层碰奖',
                        type: 'bar',
                        data: b3
                    },
                    {
                        name: '对碰奖',
                        type: 'bar',
                        data: b4
                    },
                    {
                        name: '领导奖',
                        type: 'bar',
                        data: b5
                    },
                    {
                        name: '分红奖',
                        type: 'bar',
                        data: b6
                    }
                ]
            };
            bonusChart.setOption(bonusOption);

            $(window).resize(function () {
                reSize();
            });
            reSize();   //让Echart重绘自身图表的宽高
        });

        //图表随着窗口大小改变而进行重绘
        function reSize() {
            if (inOutChart != null) {
                inOutChart.resize();
            }
            if (bonusChart != null) {
                bonusChart.resize();
            }
        }

        //时间戳格式化
        function formatDate(data) {
            var month = data.getMonth() + 1;
            var day = data.getDate();
            var fmtMonth = month < 10 ? '0' + month : month;
            var fmtDay = day < 10 ? '0' + day : day;

            return fmtMonth + "-" + fmtDay;
        }


    </script>
@endsection